package com.naicheng.ivote.views;

import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

import com.naicheng.ivote.R;
import com.naicheng.ivote.doman.TestListRes;
import com.naicheng.ivote.engin.BaseFragmentActivity;
import com.naicheng.ivote.views.fragments.StartTestFragment;
import com.naicheng.ivote.views.fragments.TestDetailFragment;

public class TestDetailQuestionActivity extends BaseFragmentActivity {
	
	
	private TestListRes item;
	public TestListRes getItem() {
		return item;
	}
	TestDetailFragment detailFragment;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.test_detail_quest);
		item = (TestListRes) getIntent().getSerializableExtra("data");
		
		getView(R.id.tv_back).setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				finish();
			}
		});
		
		TextView tv_title = getView(R.id.tv_title);
		tv_title.setTextColor(Color.WHITE);
		if(item != null){
			tv_title.setText(item.title);
		}else{
			tv_title.setText("无法获取该题目信息");
		}
		FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
		detailFragment = new TestDetailFragment();
		ft.replace(R.id.fl_container,detailFragment, detailFragment.TAG);
		ft.commit();
	}
	
	public void startText() {
		FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
		StartTestFragment startTestFragment = new StartTestFragment();
		detailFragment = new TestDetailFragment();
		ft.replace(R.id.fl_container,startTestFragment, startTestFragment.TAG);
		ft.commit();
	}
}
